<?php

/**
 * LinkEmployeeLeave filter form base class.
 *
 * @package    Amawal Invest
 * @subpackage filter
 * @author     Ameen Shoman<amin.shoman@gmail.com>
 */
abstract class BaseLinkEmployeeLeaveFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'leave_period'                  => new sfWidgetFormFilterInput(),
      'leaves_period_all'             => new sfWidgetFormFilterInput(),
      'all_emp_leaves_all_period'     => new sfWidgetFormFilterInput(),
      'all_emp_leaves_period'         => new sfWidgetFormFilterInput(),
      'section_emp_leaves_all_period' => new sfWidgetFormFilterInput(),
      'section_emp_leaves_period'     => new sfWidgetFormFilterInput(),
      'dept_emp_leaves_all_period'    => new sfWidgetFormFilterInput(),
      'dept_emp_leaves_period'        => new sfWidgetFormFilterInput(),
      'leave_percentage'              => new sfWidgetFormFilterInput(),
      'leaves_percentage_all'         => new sfWidgetFormFilterInput(),
      'section_percentage'            => new sfWidgetFormFilterInput(),
      'section_percentage_all'        => new sfWidgetFormFilterInput(),
      'dept_percentage'               => new sfWidgetFormFilterInput(),
      'dept_percentage_all'           => new sfWidgetFormFilterInput(),
      'branch_id'                     => new sfWidgetFormPropelChoice(array('model' => 'Branch', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'leave_period'                  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'leaves_period_all'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'all_emp_leaves_all_period'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'all_emp_leaves_period'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'section_emp_leaves_all_period' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'section_emp_leaves_period'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'dept_emp_leaves_all_period'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'dept_emp_leaves_period'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'leave_percentage'              => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'leaves_percentage_all'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'section_percentage'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'section_percentage_all'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'dept_percentage'               => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'dept_percentage_all'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'branch_id'                     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Branch', 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('link_employee_leave_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'LinkEmployeeLeave';
  }

  public function getFields()
  {
    return array(
      'employee_id'                   => 'ForeignKey',
      'leave_type_id'                 => 'ForeignKey',
      'month'                         => 'Number',
      'year'                          => 'Number',
      'leave_period'                  => 'Number',
      'leaves_period_all'             => 'Number',
      'all_emp_leaves_all_period'     => 'Number',
      'all_emp_leaves_period'         => 'Number',
      'section_emp_leaves_all_period' => 'Number',
      'section_emp_leaves_period'     => 'Number',
      'dept_emp_leaves_all_period'    => 'Number',
      'dept_emp_leaves_period'        => 'Number',
      'leave_percentage'              => 'Number',
      'leaves_percentage_all'         => 'Number',
      'section_percentage'            => 'Number',
      'section_percentage_all'        => 'Number',
      'dept_percentage'               => 'Number',
      'dept_percentage_all'           => 'Number',
      'branch_id'                     => 'ForeignKey',
    );
  }
}
